//package com.cbgolf.oa.manager;
//
//import android.util.Log;
//import com.cbgolf.oa.net.WebAPI;
//import com.cbgolf.oa.util.DataUtil;
//import com.koushikdutta.async.AsyncSocket;
//import com.koushikdutta.async.ByteBufferList;
//import com.koushikdutta.async.DataEmitter;
//import com.koushikdutta.async.callback.ConnectCallback;
//import com.koushikdutta.async.callback.DataCallback;
//import com.koushikdutta.async.http.AsyncHttpClient;
//import com.koushikdutta.async.http.WebSocket;
//import java.net.InetSocketAddress;
//
///**
// * Created by lq on 2018/5/2.
// */
//
//public class WsAsync {
//
//  public final static String TAG = WsAsync.class.getSimpleName();
//
//  public WsAsync() {
//    init();
//  }
//
//  private void init() {
//    String url =
//        "ws://test.cbgolf.cn/backend/messages/queue/messageNotify/" + DataUtil.getUserId();
//    String configUrl = new StringBuilder()
//        .append("ws://")
//        .append(WebAPI.IP)
//        .append(WebAPI.web_socket)
//        .toString();
//    AsyncHttpClient.getDefaultInstance().websocket(
//        configUrl,// webSocket地址
//        "8080",// 端口
//        new AsyncHttpClient.WebSocketConnectCallback() {
//          @Override
//          public void onCompleted(Exception ex, WebSocket webSocket) {
//            if (ex != null) {
//              ex.printStackTrace();
//              return;
//            }
////            webSocket.send("a string");// 发送消息的方法
////            webSocket.send(new byte[10]);
//            InetSocketAddress socketAddress = new InetSocketAddress(url, 8080);
//            webSocket.getSocket().getServer().connectSocket(socketAddress, new ConnectCallback() {
//              @Override
//              public void onConnectCompleted(Exception ex, AsyncSocket socket) {
//                Log.e("content==========", ex.toString() + "---------");
//              }
//            });
//            webSocket.setStringCallback(new WebSocket.StringCallback() {
//              @Override
//              public void onStringAvailable(String s) {
//                Log.i(TAG, "onStringAvailable: " + s);
//              }
//            });
//            webSocket.setDataCallback(new DataCallback() {
//              @Override
//              public void onDataAvailable(DataEmitter emitter, ByteBufferList byteBufferList) {
//                System.out.println("I got some bytes!");
//                // note that this data has been read
//                byteBufferList.recycle();
//              }
//            });
//          }
//        });
//
////    AsyncHttpClient.getDefaultInstance().execute()
//  }
//
//}
